package org.example.controller;


import org.example.api.ProductInterface;
import org.example.model.ProductInfo;
import org.example.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/product")
@RestController
public class ProductController implements ProductInterface {
    @Autowired
    private ProductService productService;
    @Override
    public ProductInfo getProductById(@PathVariable("productId") Integer productId){
        return productService.selectOrderById(productId);
    }
    @Override
    public String p1(Integer id) {
        return "product-service 接收到参数, id:"+id;
    }

    @Override
    public String p2(Integer id, String name) {
        return "product-service 接收到参数, id:"+id+",name:"+name;
    }

    @Override
    public String p3(ProductInfo productInfo) {
        return "product-service 接收到参数: productInfo"+productInfo.toString();
    }

    @Override
    public String p4(ProductInfo productInfo) {
        return "product-service 接收到参数: productInfo"+productInfo.toString();
    }
}
